use "mafid_ar.dta", clear
sort mafid
save "mafid_ar.dta", replace
use "ulive.dta", clear
sort cmid
save "ulive.dta", replace

use "centest2019_per_analysis_file.dta", clear
gen cit_nonres=0 if CITABR=="1" | CITNAT=="1" | CITPR=="1" | CITNO=="1" | CITUS=="1"
replace cit_nonres=1 if treatment=="C" & cit_nonres==.
sort mafid
by mafid: egen cit_nonresp=max(cit_nonres)
keep mafid cit_nonresp
duplicates drop mafid, force
save "acs_cit.dta", replace

use "centest2019_hu_analysis_file.dta", clear
sort cmid
merge cmid using "ulive.dta"
gen ulive=1 if _merge==3
replace ulive=0 if _merge==1 
drop _merge
sort cmid
rename CTBW0 ctbw0
rename HAS_SELFRESP_CTLDATA has_selfresp_ctldata 
rename M1_UAA m1_uaa
rename M4_UAA m4_uaa
rename VACANT_FLAG vacant_flag
rename TQA_FLAG tqa_flag
rename NPER nper
rename RPER rper
rename Hispanic_tract hispanic_tract
keep mafid treatment ctbw0 ctbw1-ctbw80 has_selfresp_ctldata m1_uaa m4_uaa vacant_flag nper rper ///
lrs fb_tract hispanic_tract partial_return_flag intresp_chosen mailresp_chosen tqa_flag /// 
intresp_exists one_return Return_date noncit_strata fb_strata lang_strat ///
mc_strat UR noncit_strata ulive
gen uaa=0 if m1_uaa==. & m4_uaa==.
replace uaa=1 if uaa==.
gen treat=1 if treatment=="C"
replace treat=0 if treatment=="T"
replace fb_tract=fb_tract/100
replace hispanic_tract=hispanic_tract/100
replace lrs=lrs/100
sort mafid
merge mafid using "/projects/data/PersonPlaceModel/centest/01_adrec/acs_cit.dta"
drop _merge
sort mafid
merge mafid using "/projects/data/PersonPlaceModel/centest/01_adrec/mafid_ar.dta"
gen no_ar=1 if _merge==1
replace no_ar=0 if _merge==3
replace married_filing_jointly=0 if _merge==1
replace married_filing_separately=0 if _merge==1
replace income_q=0 if _merge==1
replace no_irs=0 if _merge==1
replace multiunit=0 if _merge==1
replace singleunit=0 if _merge==1
replace otherunit=0 if _merge==1
replace mobileunit=0 if _merge==1
replace hh_size=0 if _merge==1
replace hh_size_1=0 if _merge==1
replace hh_size_2=0 if _merge==1
replace hh_size_3=0 if _merge==1
replace hh_size_4=0 if _merge==1
replace hh_size_5p=0 if _merge==1
replace age_0_4=0 if _merge==1
replace age_5_17=0 if _merge==1
replace age_18_24=0 if _merge==1
replace age_25_44=0 if _merge==1
replace age_45_64=0 if _merge==1
replace age_65p=0 if _merge==1
replace itin=0 if _merge==1
replace noncitizen=0 if _merge==1
replace noncit_ssn=0 if _merge==1
replace nat_citizen=0 if _merge==1
replace latin=0 if latin==.
replace latin1=0 if latin1==.
replace latin2=0 if latin2==.
replace hisp=0 if _merge==1
replace white=0 if _merge==1
replace black=0 if _merge==1
replace aian=0 if _merge==1
replace asian=0 if _merge==1
replace nhpi=0 if _merge==1
replace some_other_race=0 if _merge==1
replace multirace=0 if _merge==1
replace hisp_us_born=0 if _merge==1
replace white_us_born=0 if _merge==1
replace black_us_born=0 if _merge==1
replace aian_us_born=0 if _merge==1
replace asian_us_born=0 if _merge==1
replace nhpi_us_born=0 if _merge==1
replace sor_us_born=0 if _merge==1
replace miss=0 if _merge==1
replace multirace_us_born=0 if _merge==1
replace num_mafids=0 if _merge==1
replace female_unmarried_head=0 if _merge==1
replace no_irs=0 if _merge==1
replace all_noncitizen=0 if _merge==1
replace mixed_citizenship=0 if _merge==1
replace all_itin=0 if _merge==1
replace mixed_itin=0 if _merge==1
drop _merge
sort mafid
replace sor_us_born=1 if nhpi_us_born==1
save "centest_hu.dta", replace

use "centest_hu.dta", clear
replace married_filing_jointly=0 if married_filing_jointly==.
replace hisp_us_born=0 if hisp_us_born==.
gen mode=1 if intresp_chosen==1
replace mode=2 if mailresp_chosen==1
replace mode=2 if tqa_flag==1
replace mode=0 if has_selfresp_ctldata==0
gen income_1=1 if income_q==1
replace income_1=0 if income_1==.
gen income_2=1 if income_q==2
replace income_2=0 if income_2==.
gen income_3=1 if income_q==3
replace income_3=0 if income_3==.
gen income_4=1 if income_q==4
replace income_4=0 if income_4==.
gen income_5=1 if income_q==5
replace income_5=0 if income_5==.
gen latin_noncit_ssn=latin*noncit_ssn
gen non_latin_noncit_ssn=(1-latin)*noncit_ssn
gen latin_nat_citizen=latin*nat_citizen
gen non_latin_nat_citizen=(1-latin)*nat_citizen
gen noncit_strata1=1 if noncit_strata=="1"
replace noncit_strata1=0 if noncit_strata1==.
gen noncit_strata2=1 if noncit_strata=="2"
replace noncit_strata2=0 if noncit_strata2==.
gen noncit_strata3=1 if noncit_strata=="3"
replace noncit_strata3=0 if noncit_strata3==.
gen t_noncit_strata1=treat*noncit_strata1
gen t_noncit_strata2=treat*noncit_strata2
gen t_noncit_strata3=treat*noncit_strata3
gen t_uaa=treat*uaa
gen t_lrs=treat*lrs
gen t_fb_tract=treat*fb_tract
gen t_hispanic_tract=treat*hispanic_tract
gen t_no_ar=treat*no_ar
gen t_married_filing_jointly=treat*married_filing_jointly
gen t_female_unmarried_head=treat*female_unmarried_head
gen t_num_mafids=treat*num_mafids
gen t_income_q=treat*income_q
gen t_multiunit=treat*multiunit
gen t_mobileunit=treat*mobileunit
gen t_otherunit=treat*otherunit
gen t_hh_size_2=treat*hh_size_2
gen t_hh_size_3=treat*hh_size_3
gen t_hh_size_4=treat*hh_size_4
gen t_hh_size_5p=treat*hh_size_5p
gen t_age_0_4=treat*age_0_4
gen t_age_5_17=treat*age_5_17
gen t_age_18_24=treat*age_18_24
gen t_age_25_44=treat*age_25_44
gen t_age_45_64=treat*age_45_64
gen t_age_65p=treat*age_65p
gen t_nat_citizen=treat*nat_citizen
gen t_latin_nat_citizen=treat*latin_nat_citizen
gen t_non_latin_nat_citizen=treat*non_latin_nat_citizen
gen t_noncit_ssn=treat*noncit_ssn
gen t_latin_noncit_ssn=treat*latin_noncit_ssn
gen t_non_latin_noncit_ssn=treat*non_latin_noncit_ssn
gen t_itin=treat*itin
gen t_latin=treat*latin
gen t_hisp=treat*hisp
gen t_black=treat*black
gen t_aian=treat*aian
gen t_asian=treat*asian
gen t_nhpi=treat*nhpi
gen t_some_other_race=treat*some_other_race
gen t_multirace=treat*multirace
gen t_hisp_us_born=treat*hisp_us_born
gen t_black_us_born=treat*black_us_born
gen t_aian_us_born=treat*aian_us_born
gen t_asian_us_born=treat*asian_us_born
gen t_sor_us_born=treat*sor_us_born
gen t_multirace_us_born=treat*multirace_us_born
gen t_miss=treat*miss
gen t_no_irs=treat*no_irs
gen t_income_1=treat*income_1
gen t_income_2=treat*income_2
gen t_income_3=treat*income_3
gen t_income_4=treat*income_4
gen t_income_5=treat*income_5
gen cit_resp=1-cit_nonresp
gen t_noncitizen=treat*noncitizen
gen t_all_noncitizen=treat*all_noncitizen
gen t_mixed_citizenship=treat* mixed_citizenship
gen t_all_itin=treat*all_itin
gen t_mixed_itin=treat* mixed_itin
gen first_en=1 if mc_strat=="1" & lang_strat=="1"
replace first_en=0 if first_en==.
gen first_bi=1 if mc_strat=="1" & lang_strat=="2"
replace first_bi=0 if first_bi==.
gen choice_en=1 if mc_strat=="2" & lang_strat=="1"
replace choice_en=0 if choice_en==.
gen choice_bi=1 if mc_strat=="2" & lang_strat=="2"
replace choice_bi=0 if choice_bi==.
gen t_first_bi=treat*first_bi
gen t_choice_en=treat*choice_en
gen t_choice_bi=treat*choice_bi
gen rper_nper=rper-nper if rper>=2 & rper<. & nper<=rper & intresp_chosen==1 & ulive==0
gen only_white_us_born=1 if white_us_born==1 & miss==0 & hisp_us_born==0 & black_us_born==0 & aian_us_born==0 ///
& asian_us_born==0 & nhpi_us_born==0 & sor_us_born==0 & multirace_us_born==0 & nat_citizen==0 ///
& noncitizen==0
replace only_white_us_born=0 if only_white_us_born==.
gen ntreat=1-treat
gen lrs_miss=1 if lrs==.
replace lrs_miss=0 if lrs_miss==.
replace lrs=0 if lrs==.
replace t_lrs=0 if lrs_miss==1
gen t_lrs_miss=treat*lrs_miss
gen fb_tract_miss=1 if fb_tract==.
replace fb_tract_miss=0 if fb_tract_miss==.
replace fb_tract=0 if fb_tract==.
replace t_fb_tract=0 if fb_tract_miss==1
gen t_fb_tract_miss=treat*fb_tract_miss
gen hispanic_tract_miss=1 if hispanic_tract==.
replace hispanic_tract_miss=0 if hispanic_tract_miss==.
replace hispanic_tract=0 if hispanic_tract==.
replace t_hispanic_tract=0 if hispanic_tract_miss==1
gen t_hispanic_tract_miss=treat*hispanic_tract_miss
gen all_citizen=1 if mixed_citizenship==0 & all_noncitizen==0 & miss==0 & no_ar==0
replace all_citizen=0 if all_citizen==.

svyset[pweight=ctbw0], vce(brr) brrweight(ctbw1-ctbw80) fay(.5)mse

*Table 2

svy: reg all_citizen treat ntreat, nocon
test treat=ntreat
svy: reg noncitizen treat ntreat, nocon
test treat=ntreat
svy: reg mixed_citizenship treat ntreat, nocon
test treat=ntreat
svy: reg all_noncitizen treat ntreat, nocon
test treat=ntreat
svy: reg only_white_us_born treat ntreat, nocon
test treat=ntreat
svy: reg black_us_born treat ntreat, nocon
test treat=ntreat
svy: reg aian_us_born treat ntreat, nocon
test treat=ntreat
svy: reg asian_us_born treat ntreat, nocon
test treat=ntreat
svy: reg sor_us_born treat ntreat, nocon
test treat=ntreat
svy: reg multirace_us_born treat ntreat, nocon
test treat=ntreat
svy: reg hisp_us_born treat ntreat, nocon
test treat=ntreat
svy: reg latin_nat_citizen treat ntreat, nocon
test treat=ntreat
svy: reg non_latin_nat_citizen treat ntreat, nocon
test treat=ntreat
svy: reg latin_noncit_ssn treat ntreat, nocon
test treat=ntreat
svy: reg non_latin_noncit_ssn treat ntreat, nocon
test treat=ntreat
svy: reg itin treat ntreat, nocon
test treat=ntreat
svy: reg mixed_itin treat ntreat, nocon
test treat=ntreat
svy: reg all_itin treat ntreat, nocon
test treat=ntreat
svy: reg miss treat ntreat, nocon
test treat=ntreat
svy: reg no_ar treat ntreat, nocon
test treat=ntreat
svy: reg hh_size_1 treat ntreat, nocon
test treat=ntreat
svy: reg hh_size_2 treat ntreat, nocon
test treat=ntreat
svy: reg hh_size_3 treat ntreat, nocon
test treat=ntreat
svy: reg hh_size_4 treat ntreat, nocon
test treat=ntreat
svy: reg hh_size_5 treat ntreat, nocon
test treat=ntreat
svy: reg uaa treat ntreat, nocon
test treat=ntreat
svy: reg first_en treat ntreat, nocon
test treat=ntreat
svy: reg first_bi treat ntreat, nocon
test treat=ntreat
svy: reg choice_en treat ntreat, nocon
test treat=ntreat
svy: reg choice_bi treat ntreat, nocon
test treat=ntreat
svy: reg married_filing_jointly treat ntreat, nocon
test treat=ntreat
svy: reg female_unmarried_head treat ntreat, nocon
test treat=ntreat
svy: reg num_mafids treat ntreat, nocon
test treat=ntreat
svy: reg no_irs treat ntreat if no_ar==0, nocon
test treat=ntreat
svy: reg income_1 treat ntreat, nocon
test treat=ntreat
svy: reg income_2 treat ntreat, nocon
test treat=ntreat
svy: reg income_3 treat ntreat, nocon
test treat=ntreat
svy: reg income_4 treat ntreat, nocon
test treat=ntreat
svy: reg income_5 treat ntreat, nocon
test treat=ntreat
svy: reg singleunit treat ntreat, nocon
test treat=ntreat
svy: reg multiunit treat ntreat, nocon
test treat=ntreat
svy: reg mobileunit treat ntreat, nocon
test treat=ntreat
svy: reg age_0_4 treat ntreat, nocon
test treat=ntreat
svy: reg age_5_17 treat ntreat, nocon
test treat=ntreat
svy: reg age_18_24 treat ntreat, nocon
test treat=ntreat
svy: reg age_25_44 treat ntreat, nocon
test treat=ntreat
svy: reg age_45_64 treat ntreat, nocon
test treat=ntreat
svy: reg age_65p treat ntreat, nocon
test treat=ntreat

*Table 3 and Appendix Table 2 

svy: logit has_selfresp_ctldata treat
estat gof
margins, dydx(treat)
svy: logit has_selfresp_ctldata treat lrs t_lrs lrs_miss t_lrs_miss
estat gof
margins, dydx(treat lrs t_lrs lrs_miss t_lrs_miss)
svy: logit has_selfresp_ctldata treat hispanic_tract t_hispanic_tract hispanic_tract_miss ///
t_hispanic_tract_miss
estat gof
margins, dydx(treat hispanic_tract t_hispanic_tract hispanic_tract_miss ///
t_hispanic_tract_miss)
svy: logit has_selfresp_ctldata treat fb_tract t_fb_tract fb_tract_miss t_fb_tract_miss
estat gof
margins, dydx(treat fb_tract t_fb_tract fb_tract_miss t_fb_tract_miss)
svy: logit has_selfresp_ctldata treat noncit_strata2 t_noncit_strata2 ///
noncit_strata1 t_noncit_strata1
estat gof
margins, dydx(treat noncit_strata2 t_noncit_strata2 ///
noncit_strata1 t_noncit_strata1)

*Table 4

svy: reg has_selfresp_ctldata treat ntreat, nocon
test treat=ntreat
gen tall_citizen=treat*all_citizen
gen nall_citizen=ntreat*all_citizen
svy: reg has_selfresp_ctldata tall_citizen nall_citizen, nocon
test tall_citizen=nall_citizen
drop tall_citizen nall_citizen
gen tnoncitizen=treat*noncitizen
gen nnoncitizen=ntreat*noncitizen
svy: reg has_selfresp_ctldata tnoncitizen nnoncitizen, nocon
test tnoncitizen=nnoncitizen
drop tnoncitizen nnoncitizen
gen tmixed_citizenship=treat*mixed_citizenship
gen nmixed_citizenship=ntreat*mixed_citizenship
svy: reg has_selfresp_ctldata tmixed_citizenship nmixed_citizenship, nocon
test tmixed_citizenship=nmixed_citizenship
drop tmixed_citizenship nmixed_citizenship
gen tall_noncitizen=treat*all_noncitizen
gen nall_noncitizen=ntreat*all_noncitizen
svy: reg has_selfresp_ctldata tall_noncitizen nall_noncitizen, nocon
test tall_noncitizen=nall_noncitizen
drop tall_noncitizen nall_noncitizen
gen tonly_white_us_born=treat*only_white_us_born
gen nonly_white_us_born=ntreat*only_white_us_born
svy: reg has_selfresp_ctldata tonly_white_us_born nonly_white_us_born, nocon
test tonly_white_us_born=nonly_white_us_born
drop tonly_white_us_born nonly_white_us_born
gen tblack_us_born=treat*black_us_born
gen nblack_us_born=ntreat*black_us_born
svy: reg has_selfresp_ctldata tblack_us_born nblack_us_born, nocon
test tblack_us_born=nblack_us_born
drop tblack_us_born nblack_us_born
gen taian_us_born=treat*aian_us_born
gen naian_us_born=ntreat*aian_us_born
svy: reg has_selfresp_ctldata taian_us_born naian_us_born, nocon
test taian_us_born=naian_us_born
drop taian_us_born=naian_us_born
gen tasian_us_born=treat*asian_us_born
gen nasian_us_born=ntreat*asian_us_born
svy: reg has_selfresp_ctldata tasian_us_born nasian_us_born, nocon
test tasian_us_born=nasian_us_born
drop tasian_us_born nasian_us_born
gen tsor_us_born=treat*sor_us_born
gen nsor_us_born=ntreat*sor_us_born
svy: reg has_selfresp_ctldata tsor_us_born nsor_us_born, nocon
test tsor_us_born=nsor_us_born
drop tsor_us_born nsor_us_born
gen tmultirace_us_born=treat*multirace_us_born
gen nmultirace_us_born=ntreat*multirace_us_born
svy: reg has_selfresp_ctldata tmultirace_us_born nmultirace_us_born, nocon
test tmultirace_us_born=nmultirace_us_born
drop tmultirace_us_born nmultirace_us_born
gen thisp_us_born=treat*hisp_us_born
gen nhisp_us_born=ntreat*hisp_us_born
svy: reg has_selfresp_ctldata thisp_us_born nhisp_us_born, nocon
test thisp_us_born=nhisp_us_born
drop thisp_us_born nhisp_us_born
gen tlatin_nat_citizen=treat*latin_nat_citizen
gen nlatin_nat_citizen=ntreat*latin_nat_citizen
svy: reg has_selfresp_ctldata tlatin_nat_citizen nlatin_nat_citizen, nocon
test tlatin_nat_citizen=nlatin_nat_citizen
drop tlatin_nat_citizen nlatin_nat_citizen
gen tnon_latin_nat_citizen=treat*non_latin_nat_citizen
gen nnon_latin_nat_citizen=ntreat*non_latin_nat_citizen
svy: reg has_selfresp_ctldata tnon_latin_nat_citizen nnon_latin_nat_citizen, nocon
test tnon_latin_nat_citizen=nnon_latin_nat_citizen
drop tnon_latin_nat_citizen nnon_latin_nat_citizen
gen tlatin_noncit_ssn=treat*latin_noncit_ssn
gen nlatin_noncit_ssn=ntreat*latin_noncit_ssn
svy: reg has_selfresp_ctldata tlatin_noncit_ssn nlatin_noncit_ssn, nocon
test tlatin_noncit_ssn=nlatin_noncit_ssn
drop tlatin_noncit_ssn nlatin_noncit_ssn
gen tnon_latin_noncit_ssn=treat*non_latin_noncit_ssn
gen nnon_latin_noncit_ssn=ntreat*non_latin_noncit_ssn
svy: reg has_selfresp_ctldata tnon_latin_noncit_ssn nnon_latin_noncit_ssn, nocon
test tnon_latin_noncit_ssn=nnon_latin_noncit_ssn
drop tnon_latin_noncit_ssn nnon_latin_noncit_ssn
gen titin=treat*itin
gen nitin=ntreat*itin
svy: reg has_selfresp_ctldata titin nitin, nocon
test titin=nitin
drop titin nitin
gen tmixed_itin=treat*mixed_itin
gen nmixed_itin=ntreat*mixed_itin
svy: reg has_selfresp_ctldata tmixed_itin nmixed_itin, nocon
test tmixed_itin=nmixed_itin
drop tmixed_itin nmixed_itin
gen tmiss=treat*miss
gen nmiss=ntreat*miss
svy: reg has_selfresp_ctldata tmiss nmiss, nocon
test tmiss=nmiss
drop tmiss nmiss
gen tno_ar=treat*no_ar
gen nno_ar=ntreat*no_ar
svy: reg has_selfresp_ctldata tno_ar nno_ar, nocon
test tno_ar=nno_ar
drop tno_ar nno_ar

*Table 5 and Appendix Table 2

svy: logit has_selfresp_ctldata treat black_us_born t_black_us_born aian_us_born ///
t_aian_us_born asian_us_born t_asian_us_born sor_us_born t_sor_us_born multirace_us_born t_multirace_us_born hisp_us_born ///
t_hisp_us_born miss t_miss no_ar t_no_ar latin_nat_citizen t_latin_nat_citizen ///
non_latin_nat_citizen ///
t_non_latin_nat_citizen latin_noncit_ssn t_latin_noncit_ssn non_latin_noncit_ssn t_non_latin_noncit_ssn itin t_itin
estat gof
margins, dydx(treat black_us_born t_black_us_born aian_us_born ///
t_aian_us_born asian_us_born t_asian_us_born sor_us_born t_sor_us_born multirace_us_born t_multirace_us_born hisp_us_born ///
t_hisp_us_born miss t_miss no_ar t_no_ar latin_nat_citizen t_latin_nat_citizen ///
non_latin_nat_citizen ///
t_non_latin_nat_citizen latin_noncit_ssn t_latin_noncit_ssn non_latin_noncit_ssn t_non_latin_noncit_ssn itin t_itin)
svy: logit has_selfresp_ctldata treat black_us_born t_black_us_born aian_us_born ///
t_aian_us_born asian_us_born t_asian_us_born sor_us_born t_sor_us_born multirace_us_born t_multirace_us_born hisp_us_born ///
t_hisp_us_born miss t_miss no_ar t_no_ar latin_nat_citizen t_latin_nat_citizen ///
non_latin_nat_citizen ///
t_non_latin_nat_citizen latin_noncit_ssn t_latin_noncit_ssn non_latin_noncit_ssn t_non_latin_noncit_ssn itin t_itin uaa t_uaa first_bi t_first_bi choice_en t_choice_en ///
choice_bi t_choice_bi no_ar t_no_ar married_filing_jointly t_married_filing_jointly ///
female_unmarried_head t_female_unmarried_head num_mafids t_num_mafids income_1 t_income_1 ///
income_2 t_income_2 income_3 t_income_3 income_4 t_income_4 income_5 t_income_5 multiunit /// 
t_multiunit mobileunit t_mobileunit ///
hh_size_2 t_hh_size_2 hh_size_3 t_hh_size_3 hh_size_4 t_hh_size_4 hh_size_5p t_hh_size_5p ///
age_0_4 t_age_0_4 age_5_17 t_age_5_17 age_18_24 t_age_18_24 age_45_64 t_age_45_64 ///
age_65p t_age_65p
estat gof
margins, dydx(treat black_us_born t_black_us_born aian_us_born ///
t_aian_us_born asian_us_born t_asian_us_born sor_us_born t_sor_us_born multirace_us_born t_multirace_us_born hisp_us_born ///
t_hisp_us_born miss t_miss no_ar t_no_ar latin_nat_citizen t_latin_nat_citizen ///
non_latin_nat_citizen ///
t_non_latin_nat_citizen latin_noncit_ssn t_latin_noncit_ssn non_latin_noncit_ssn t_non_latin_noncit_ssn itin t_itin)

*Table 6

svy: reg rper_nper treat
svy: reg rper_nper treat lrs t_lrs lrs_miss t_lrs_miss
svy: reg rper_nper treat hispanic_tract t_hispanic_tract hispanic_tract_miss ///
t_hispanic_tract_miss
svy: reg rper_nper treat fb_tract t_fb_tract fb_tract_miss t_fb_tract_miss
svy: reg rper_nper treat noncit_strata2 t_noncit_strata2 ///
noncit_strata1 t_noncit_strata1

*Table 7

svy: reg rper_nper treat ntreat, nocon
test treat=ntreat
gen tall_citizen=treat*all_citizen
gen nall_citizen=ntreat*all_citizen
svy: reg rper_nper tall_citizen nall_citizen, nocon
test tall_citizen=nall_citizen
drop tall_citizen nall_citizen
gen tnoncitizen=treat*noncitizen
gen nnoncitizen=ntreat*noncitizen
svy: reg rper_nper tnoncitizen nnoncitizen, nocon
test tnoncitizen=nnoncitizen
drop tnoncitizen nnoncitizen
gen tmixed_citizenship=treat*mixed_citizenship
gen nmixed_citizenship=ntreat*mixed_citizenship
svy: reg rper_nper tmixed_citizenship nmixed_citizenship, nocon
test tmixed_citizenship=nmixed_citizenship
drop tmixed_citizenship nmixed_citizenship
gen tall_noncitizen=treat*all_noncitizen
gen nall_noncitizen=ntreat*all_noncitizen
svy: reg rper_nper tall_noncitizen nall_noncitizen, nocon
test tall_noncitizen=nall_noncitizen
drop tall_noncitizen nall_noncitizen
gen tonly_white_us_born=treat*only_white_us_born
gen nonly_white_us_born=ntreat*only_white_us_born
svy: reg rper_nper tonly_white_us_born nonly_white_us_born, nocon
test tonly_white_us_born=nonly_white_us_born
drop tonly_white_us_born nonly_white_us_born
gen tblack_us_born=treat*black_us_born
gen nblack_us_born=ntreat*black_us_born
svy: reg rper_nper tblack_us_born nblack_us_born, nocon
test tblack_us_born=nblack_us_born
drop tblack_us_born nblack_us_born
gen taian_us_born=treat*aian_us_born
gen naian_us_born=ntreat*aian_us_born
svy: reg rper_nper taian_us_born naian_us_born, nocon
test taian_us_born=naian_us_born
drop taian_us_born=naian_us_born
gen tasian_us_born=treat*asian_us_born
gen nasian_us_born=ntreat*asian_us_born
svy: reg rper_nper tasian_us_born nasian_us_born, nocon
test tasian_us_born=nasian_us_born
drop tasian_us_born nasian_us_born
gen tsor_us_born=treat*sor_us_born
gen nsor_us_born=ntreat*sor_us_born
svy: reg rper_nper tsor_us_born nsor_us_born, nocon
test tsor_us_born=nsor_us_born
drop tsor_us_born nsor_us_born
gen tmultirace_us_born=treat*multirace_us_born
gen nmultirace_us_born=ntreat*multirace_us_born
svy: reg rper_nper tmultirace_us_born nmultirace_us_born, nocon
test tmultirace_us_born=nmultirace_us_born
drop tmultirace_us_born nmultirace_us_born
gen thisp_us_born=treat*hisp_us_born
gen nhisp_us_born=ntreat*hisp_us_born
svy: reg rper_nper thisp_us_born nhisp_us_born, nocon
test thisp_us_born=nhisp_us_born
drop thisp_us_born nhisp_us_born
gen tlatin_nat_citizen=treat*latin_nat_citizen
gen nlatin_nat_citizen=ntreat*latin_nat_citizen
svy: reg rper_nper tlatin_nat_citizen nlatin_nat_citizen, nocon
test tlatin_nat_citizen=nlatin_nat_citizen
drop tlatin_nat_citizen nlatin_nat_citizen
gen tnon_latin_nat_citizen=treat*non_latin_nat_citizen
gen nnon_latin_nat_citizen=ntreat*non_latin_nat_citizen
svy: reg rper_nper tnon_latin_nat_citizen nnon_latin_nat_citizen, nocon
test tnon_latin_nat_citizen=nnon_latin_nat_citizen
drop tnon_latin_nat_citizen nnon_latin_nat_citizen
gen tlatin_noncit_ssn=treat*latin_noncit_ssn
gen nlatin_noncit_ssn=ntreat*latin_noncit_ssn
svy: reg rper_nper tlatin_noncit_ssn nlatin_noncit_ssn, nocon
test tlatin_noncit_ssn=nlatin_noncit_ssn
drop tlatin_noncit_ssn nlatin_noncit_ssn
gen tnon_latin_noncit_ssn=treat*non_latin_noncit_ssn
gen nnon_latin_noncit_ssn=ntreat*non_latin_noncit_ssn
svy: reg rper_nper tnon_latin_noncit_ssn nnon_latin_noncit_ssn, nocon
test tnon_latin_noncit_ssn=nnon_latin_noncit_ssn
drop tnon_latin_noncit_ssn nnon_latin_noncit_ssn
gen titin=treat*itin
gen nitin=ntreat*itin
svy: reg rper_nper titin nitin, nocon
test titin=nitin
drop titin nitin
gen tmixed_itin=treat*mixed_itin
gen nmixed_itin=ntreat*mixed_itin
svy: reg rper_nper tmixed_itin nmixed_itin, nocon
test tmixed_itin=nmixed_itin
drop tmixed_itin nmixed_itin
gen tmiss=treat*miss
gen nmiss=ntreat*miss
svy: reg rper_nper tmiss nmiss, nocon
test tmiss=nmiss
drop tmiss nmiss
gen tno_ar=treat*no_ar
gen nno_ar=ntreat*no_ar
svy: reg rper_nper tno_ar nno_ar, nocon
test tno_ar=nno_ar
drop tno_ar nno_ar

*Table 8

svy: reg rper_nper treat black_us_born t_black_us_born aian_us_born ///
t_aian_us_born asian_us_born t_asian_us_born sor_us_born t_sor_us_born multirace_us_born ///
t_multirace_us_born hisp_us_born t_hisp_us_born miss t_miss latin_nat_citizen ///
t_latin_nat_citizen non_latin_nat_citizen ///
t_non_latin_nat_citizen latin_noncit_ssn t_latin_noncit_ssn non_latin_noncit_ssn /// 
t_non_latin_noncit_ssn itin t_itin no_ar t_no_ar ///
svy: reg rper_nper treat black_us_born t_black_us_born aian_us_born t_aian_us_born ///
asian_us_born t_asian_us_born sor_us_born ///
t_sor_us_born multirace_us_born t_multirace_us_born hisp_us_born t_hisp_us_born miss t_miss ///
latin_nat_citizen t_latin_nat_citizen non_latin_nat_citizen ///
t_non_latin_nat_citizen latin_noncit_ssn t_latin_noncit_ssn non_latin_noncit_ssn ///
t_non_latin_noncit_ssn itin t_itin uaa t_uaa first_bi t_first_bi choice_en t_choice_en ///
choice_bi t_choice_bi no_ar t_no_ar married_filing_jointly t_married_filing_jointly ///
female_unmarried_head t_female_unmarried_head num_mafids t_num_mafids income_1 t_income_1 ///
income_2 t_income_2 income_3 t_income_3 income_4 t_income_4 income_5 t_income_5 multiunit /// 
t_multiunit mobileunit t_mobileunit ///
hh_size_2 t_hh_size_2 hh_size_3 t_hh_size_3 hh_size_4 t_hh_size_4 hh_size_5p t_hh_size_5p ///
age_0_4 t_age_0_4 age_5_17 t_age_5_17 age_18_24 t_age_18_24 age_45_64 t_age_45_64 ///
age_65p t_age_65p 

*Table 9

svy: logit cit_resp treat if mailresp_chosen==1
margins, dydx(treat)
svy: logit cit_resp treat lrs t_lrs lrs_miss t_lrs_miss if mailresp_chosen==1
margins, dydx(treat lrs t_lrs lrs_miss t_lrs_miss)
svy: logit cit_resp treat hispanic_tract t_hispanic_tract hispanic_tract_miss ///
t_hispanic_tract_miss if mailresp_chosen==1
margins, dydx(treat hispanic_tract t_hispanic_tract hispanic_tract_miss ///
t_hispanic_tract_miss)
svy: logit cit_resp treat fb_tract t_fb_tract fb_tract_miss t_fb_tract_miss ///
if mailresp_chosen==1
margins, dydx(treat fb_tract t_fb_tract fb_tract_miss t_fb_tract_miss)
svy: logit cit_resp treat noncit_strata2 t_noncit_strata2 ///
noncit_strata1 t_noncit_strata1 if mailresp_chosen==1
margins, dydx(treat noncit_strata2 t_noncit_strata2 ///
noncit_strata1 t_noncit_strata1)

*Table 10

svy: tab cit_resp if treat==1 & mailresp_chosen==1
svy: tab cit_resp if all_citizen==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if noncitizen==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if mixed_citizenship==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if all_noncitizen==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if only_white_us_born==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if black_us_born==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if aian_us_born==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if asian_us_born==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if sor_us_born==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if multirace_us_born==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if hisp_us_born==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if latin_nat_citizen==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if non_latin_nat_citizen==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if latin_noncit_ssn==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if non_latin_noncit_ssn==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if itin==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if mixed_itin==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if all_itin==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if no_ar==1 & treat==1 & mailresp_chosen==1
svy: tab cit_resp if miss==1 & treat==1 & mailresp_chosen==1

*Table 11

svy: logit cit_resp black_us_born aian_us_born ///
asian_us_born sor_us_born multirace_us_born hisp_us_born ///
latin_nat_citizen non_latin_nat_citizen ///
latin_noncit_ssn non_latin_noncit_ssn itin miss no_ar if mailresp_chosen==1
margins, dydx(black_us_born aian_us_born ///
asian_us_born sor_us_born multirace_us_born hisp_us_born ///
latin_nat_citizen non_latin_nat_citizen ///
latin_noncit_ssn non_latin_noncit_ssn itin miss no_ar)
svy: logit cit_resp black_us_born aian_us_born ///
asian_us_born sor_us_born multirace_us_born hisp_us_born ///
latin_nat_citizen non_latin_nat_citizen ///
latin_noncit_ssn non_latin_noncit_ssn itin miss no_ar ///
uaa first_bi choice_en ///
choice_bi married_filing_jointly ///
female_unmarried_head num_mafids income_1 ///
income_2 income_3 income_4 income_5 multiunit /// 
mobileunit ///
hh_size_2 hh_size_3 hh_size_4 hh_size_5p ///
age_0_4 age_5_17 age_18_24 age_45_64 ///
age_65p if mailresp_chosen==1
margins, dydx(black_us_born aian_us_born ///
asian_us_born sor_us_born multirace_us_born hisp_us_born ///
latin_nat_citizen non_latin_nat_citizen ///
latin_noncit_ssn non_latin_noncit_ssn itin miss no_ar)
















